
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Milton
 */
public class VentanaVendedor extends javax.swing.JFrame implements ActionListener{
    VentanaIngresarSistema ventanaAnterior;
    /**
     * Creates new form NewJFrame
     */
    public VentanaVendedor(VentanaIngresarSistema ventanaAnterior) {
        this.ventanaAnterior = ventanaAnterior;
        initComponents();
        setControlador();
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    
    public void setControlador(){
        botonCerrar.addActionListener(this);
        itemApDesc.addActionListener(this);
        itemConsExist.addActionListener(this);
        itemConsultCli.addActionListener(this);
        itemCrearCli.addActionListener(this);
        itemModCli.addActionListener(this);
      
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelTitulo = new javax.swing.JLabel();
        etiquetaImagenUsr = new javax.swing.JLabel();
        etiquetaTM = new javax.swing.JLabel();
        botonCerrar = new javax.swing.JButton();
        BarraMenu = new javax.swing.JMenuBar();
        menuClientes = new javax.swing.JMenu();
        itemCrearCli = new javax.swing.JMenuItem();
        itemConsultCli = new javax.swing.JMenuItem();
        itemModCli = new javax.swing.JMenuItem();
        menuProductos = new javax.swing.JMenu();
        itemConsExist = new javax.swing.JMenuItem();
        menuDescuentos = new javax.swing.JMenu();
        itemApDesc = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        labelTitulo.setFont(new java.awt.Font("Consolas", 1, 36)); // NOI18N
        labelTitulo.setForeground(new java.awt.Color(0, 51, 102));
        labelTitulo.setText("VENDEDOR");

        etiquetaImagenUsr.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/592335_d30580a7fb176aed63e65d105ecc86b1.png"))); // NOI18N

        etiquetaTM.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/LogoTecnomundo.png"))); // NOI18N

        botonCerrar.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N
        botonCerrar.setForeground(new java.awt.Color(204, 255, 255));
        botonCerrar.setText("Cerrar Sesión");

        menuClientes.setForeground(new java.awt.Color(0, 51, 102));
        menuClientes.setText("Clientes");
        menuClientes.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N

        itemCrearCli.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        itemCrearCli.setForeground(new java.awt.Color(0, 51, 102));
        itemCrearCli.setText("Crear Cliente");
        menuClientes.add(itemCrearCli);

        itemConsultCli.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        itemConsultCli.setForeground(new java.awt.Color(0, 51, 102));
        itemConsultCli.setText("Consultar Cliente");
        itemConsultCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemConsultCliActionPerformed(evt);
            }
        });
        menuClientes.add(itemConsultCli);

        itemModCli.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        itemModCli.setForeground(new java.awt.Color(0, 51, 102));
        itemModCli.setText("Modificar Cliente");
        menuClientes.add(itemModCli);

        BarraMenu.add(menuClientes);

        menuProductos.setForeground(new java.awt.Color(0, 51, 102));
        menuProductos.setText("Productos");
        menuProductos.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N

        itemConsExist.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        itemConsExist.setForeground(new java.awt.Color(0, 51, 102));
        itemConsExist.setText("Consultar existencias producto en sucursal");
        menuProductos.add(itemConsExist);

        BarraMenu.add(menuProductos);

        menuDescuentos.setForeground(new java.awt.Color(0, 51, 102));
        menuDescuentos.setText("Venta");
        menuDescuentos.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N

        itemApDesc.setFont(new java.awt.Font("Trebuchet MS", 1, 12)); // NOI18N
        itemApDesc.setForeground(new java.awt.Color(0, 51, 102));
        itemApDesc.setText("Realizar Venta");
        menuDescuentos.add(itemApDesc);

        BarraMenu.add(menuDescuentos);

        setJMenuBar(BarraMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(326, 326, 326)
                        .addComponent(labelTitulo))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(56, 56, 56)
                        .addComponent(etiquetaTM, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(107, 107, 107)
                        .addComponent(etiquetaImagenUsr))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(294, 294, 294)
                        .addComponent(botonCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(61, 81, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(labelTitulo)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(55, 55, 55)
                        .addComponent(etiquetaTM)
                        .addGap(55, 55, 55))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(etiquetaImagenUsr, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                .addComponent(botonCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        getAccessibleContext().setAccessibleName("Funciones");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void itemConsultCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemConsultCliActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_itemConsultCliActionPerformed

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar BarraMenu;
    private javax.swing.JButton botonCerrar;
    private javax.swing.JLabel etiquetaImagenUsr;
    private javax.swing.JLabel etiquetaTM;
    private javax.swing.JMenuItem itemApDesc;
    private javax.swing.JMenuItem itemConsExist;
    private javax.swing.JMenuItem itemConsultCli;
    private javax.swing.JMenuItem itemCrearCli;
    private javax.swing.JMenuItem itemModCli;
    private javax.swing.JLabel labelTitulo;
    private javax.swing.JMenu menuClientes;
    private javax.swing.JMenu menuDescuentos;
    private javax.swing.JMenu menuProductos;
    // End of variables declaration//GEN-END:variables

    @Override
    public void actionPerformed(ActionEvent ae) {
        if(ae.getActionCommand().equals("Crear Cliente")){
            VentanaAdminCliente ventanaCrearCliente = new VentanaAdminCliente("Crear");
            ventanaCrearCliente.setVisible(true);
            ventanaCrearCliente.setLocationRelativeTo(this);
        }
        
        if(ae.getActionCommand().equals("Consultar Cliente")){
            VentanaIDAdminCliente ventanaIDConsultarCliente = new VentanaIDAdminCliente("Consultar");
            ventanaIDConsultarCliente.setVisible(true);
            ventanaIDConsultarCliente.setLocationRelativeTo(this);
        }
        
        if(ae.getActionCommand().equals("Modificar Cliente")){
            VentanaIDAdminCliente ventanaIDModificarCliente = new VentanaIDAdminCliente("Modificar");
            ventanaIDModificarCliente.setVisible(true);
            ventanaIDModificarCliente.setLocationRelativeTo(this); 
        }
        
        if(ae.getActionCommand().equals("Consultar existencias producto en sucursal")){
            JOptionPane.showMessageDialog(null, "Implementame! D:");
        }
        
        if(ae.getActionCommand().equals("Realizar Venta")){
            VentanaVenta ventanaVenta = new VentanaVenta();
            ventanaVenta.setVisible(true);
            ventanaVenta.setLocationRelativeTo(this);
            
        }
        
        if(ae.getActionCommand().equals("Cerrar Sesión")){
            ventanaAnterior.setVisible(true);
            this.dispose();
        }
    }
}
